<template>
		<div class="card-header">
			<span><h3>历史反馈信息列表</h3></span>
		</div>
		 <el-table :data="tableData2" style="width: 50%">
		    <el-table-column prop="feedbackAqi" label="空气质量等级" />
		    <el-table-column prop="date" label="反馈时间"  />
		    <el-table-column prop="province" label="反馈省份" />
			<el-table-column prop="city" label="反馈城市" />
		  </el-table>
		  <el-button @click="test">查看</el-button>
</template>

<script setup>
import { onMounted, ref } from 'vue'
import { useDateFormatter } from '@/composables/UserDateFormatter'
import { useRoute } from 'vue-router';
// import axios from 'axios';
import axios from '../../axios';


const route=useRoute()


//返回值对象
const datalist=ref(null)

const loading = ref(true)
const error = ref(null)
const tableData2=ref()

const tokenValue=localStorage.getItem('token')
//定义请求数据的参数
const fetchData=async ()=>{
	try{
		 axios.get('http://192.168.231.54:7000/service-supervisor/supervisor/getAllFeedbackBySupervisor',
		{
			headers: {
			  'Authorization': `Bearer ${tokenValue}`,
			},
		})
		.then(res=>{
			datalist.value=res.data.sendResult
			console.log("datalist数据：",datalist.value)
			
		})
	}catch(err){
		console.error('Error fetching data:'+err.message)
	}finally{
		loading.value=false;
	}
}

//在组件挂载时调用fetchData函数
onMounted(()=>{
	fetchData()
})

const test=()=>{
	
	tableData2.value=datalist.value
	console.log("tabledata2数据：",tableData2.value)
}


</script>

<style>
</style> 